#include"comm.hpp"



int main()
{
    int shmid = GetShm();
    char* shmaddr = (char*)shmat(shmid, nullptr, 0);

        //打开信道
    int fd = open(FIFO_FILE, O_WRONLY);
    if(fd < 0)
    {
        log(Fatal, "error string: %s, error code: %d", strerror(errno), errno);
        exit(FIFO_OPEN_ERR);
    }

    // char buffer[1024];
    //ipc code
    while(true)
    {
        cout<<"please  Enter:";
        // fgets(buffer, sizeof(buffer), stdin);
        // memcpy(shmaddr, buffer, strlen(buffer)+1);
        fgets(shmaddr, SIZE, stdin);

        write(fd, "c", 1);
    }

    close(fd);
    shmdt(shmaddr);
    return 0;
}